ADD_EXECUTABLE(igtl_image_test      igtl_image_test.c)
ADD_EXECUTABLE(igtl_header_test     igtl_header_test.c)
ADD_EXECUTABLE(igtl_transform_test  igtl_transform_test.c)
ADD_EXECUTABLE(igtl_status_test     igtl_status_test.c)
ADD_EXECUTABLE(igtl_util_test       igtl_util_test.c)
ADD_EXECUTABLE(igtl_position_test   igtl_position_test.c)
ADD_EXECUTABLE(igtl_capability_test igtl_capability_test.c)

IF(${OpenIGTLink_PROTOCOL_VERSION} GREATER "1")
  ADD_EXECUTABLE(igtl_colortable_test igtl_colortable_test.c)
  ADD_EXECUTABLE(igtl_imgmeta_test    igtl_imgmeta_test.c)
  ADD_EXECUTABLE(igtl_lbmeta_test     igtl_lbmeta_test.c)
  ADD_EXECUTABLE(igtl_point_test      igtl_point_test.c)
  ADD_EXECUTABLE(igtl_tdata_test      igtl_tdata_test.c)
  ADD_EXECUTABLE(igtl_trajectory_test igtl_trajectory_test.c)
  ADD_EXECUTABLE(igtl_sensor_test     igtl_sensor_test.c)
  ADD_EXECUTABLE(igtl_string_test     igtl_string_test.c)
  ADD_EXECUTABLE(igtl_bind_test       igtl_bind_test.c)
  ADD_EXECUTABLE(igtl_ndarray_test    igtl_ndarray_test.c)
  ADD_EXECUTABLE(igtl_polydata_test   igtl_polydata_test.c)
ENDIF()

TARGET_LINK_LIBRARIES(igtl_image_test       OpenIGTLink)
TARGET_LINK_LIBRARIES(igtl_header_test      OpenIGTLink)
TARGET_LINK_LIBRARIES(igtl_transform_test   OpenIGTLink)
TARGET_LINK_LIBRARIES(igtl_status_test      OpenIGTLink)
TARGET_LINK_LIBRARIES(igtl_util_test        OpenIGTLink)
TARGET_LINK_LIBRARIES(igtl_position_test    OpenIGTLink)
TARGET_LINK_LIBRARIES(igtl_capability_test  OpenIGTLink)

IF(${OpenIGTLink_PROTOCOL_VERSION} GREATER "1")
  TARGET_LINK_LIBRARIES(igtl_colortable_test  OpenIGTLink)
  TARGET_LINK_LIBRARIES(igtl_imgmeta_test     OpenIGTLink)
  TARGET_LINK_LIBRARIES(igtl_lbmeta_test      OpenIGTLink)
  TARGET_LINK_LIBRARIES(igtl_point_test       OpenIGTLink)
  TARGET_LINK_LIBRARIES(igtl_tdata_test       OpenIGTLink)
  TARGET_LINK_LIBRARIES(igtl_trajectory_test  OpenIGTLink)
  TARGET_LINK_LIBRARIES(igtl_sensor_test      OpenIGTLink)
  TARGET_LINK_LIBRARIES(igtl_string_test      OpenIGTLink)
  TARGET_LINK_LIBRARIES(igtl_bind_test        OpenIGTLink)
  TARGET_LINK_LIBRARIES(igtl_ndarray_test     OpenIGTLink)
  TARGET_LINK_LIBRARIES(igtl_polydata_test    OpenIGTLink)
ENDIF()

ADD_TEST(igtl_image_test_01      ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/igtl_image_test )
ADD_TEST(igtl_header_test_01     ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/igtl_header_test )
ADD_TEST(igtl_transform_test_01  ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/igtl_transform_test )
ADD_TEST(igtl_status_test_01     ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/igtl_status_test )
ADD_TEST(igtl_util_test_01       ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/igtl_util_test )
ADD_TEST(igtl_position_test_01   ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/igtl_position_test )
ADD_TEST(igtl_capability_test_01 ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/igtl_capability_test )

IF(${OpenIGTLink_PROTOCOL_VERSION} GREATER "1")
  ADD_TEST(igtl_colortable_test_01 ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/igtl_colortable_test )
  ADD_TEST(igtl_imgmeta_test_01    ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/igtl_imgmeta_test )
  ADD_TEST(igtl_lbmeta_test_01     ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/igtl_lbmeta_test )
  ADD_TEST(igtl_point_test_01      ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/igtl_point_test )
  ADD_TEST(igtl_tdata_test_01      ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/igtl_tdata_test )
  ADD_TEST(igtl_trajectory_test_01 ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/igtl_trajectory_test )
  ADD_TEST(igtl_sensor_test_01     ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/igtl_sensor_test )
  ADD_TEST(igtl_string_test_01     ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/igtl_string_test )
  ADD_TEST(igtl_bind_test_01       ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/igtl_bind_test )
  ADD_TEST(igtl_ndarray_test_01    ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/igtl_ndarray_test )
  ADD_TEST(igtl_polydata_test_01   ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/igtl_polydata_test )
ENDIF()
